<section class="content-header">
  <!-- <h1>
        变更记录
        <small ng-bind="module.name"></small>
    </h1> -->
  <ol class="breadcrumb">
    <li><a ui-sref="dashboard"><i class="fa fa-dashboard"></i>我的面板</a></li>
    <li><a ui-sref="history({module_id:module.id, code: module.code, source_id: module.source_id, customer_id: data.customer_id})">{{module.name}}变更记录</a></li>
    <li class="active">详情</li>
  </ol>
</section>
<section class="content">
  <form class="form-horizontal view-form" id="abroad_form">
    <div class="detail-view-header-wrapper">
      <div class="box-footer detail-view-header" ui-scrollpoint ui-scrollpoint-enabled="true" ui-scrollpoint-class="fixed">
        <button type="button" class="btn btn-info" ui-sref="history_edit({module_id: module.id, code:module.code, source_id: module.source_id, id: module.change_id})" ng-if="data.status == 0 || data.review_status == 0" ui-sref-opts="{reload:true}">修改</button>
        <button type="button" class="btn btn-primary" ng-click="submitAudit()" ng-if="data.status == 0 || data.review_status == 0">提交审核</button>
        <button type="button" class="btn btn-primary" ng-click="reAudit()" ng-if="data.status >= 1 && data.order_status == 0 && userInfo.username=='admin'">反审核</button>
        <button type="button" class="btn btn-success" ng-click="passAuditF()" ng-if="data.status==1 && opers.indexOf(3) > -1">财务审核通过</button>
        <button type="button" class="btn btn-danger" ng-click="refuseAudit()" ng-if="data.status==1 && opers.indexOf(3) > -1">财务审核驳回</button>
        <button type="button" class="btn btn-success" ng-click="passAudit()" ng-if="data.status > 1 && data.status < 3 && opers.indexOf(4) > -1">提交审核通过</button>
        <button type="button" class="btn btn-danger" ng-click="refuseAudit()" ng-if="data.status > 1 && data.status < 3 && opers.indexOf(4) > -1">提交审核驳回</button>
        <button type="button" class="btn btn-success" ng-click="progress()" ng-if="data.status == 3 && data.review_status==1">进度反馈</button>
        <button type="button" class="btn btn-info" ui-sref="history_timeline({id: data.id, name: 'history', code: data.order_code, source: 'view'})"><span class="fa fa-clock-o"></span>日志</button>
        <a href="/print.html?m=history&id={{id}}&shareholder={{data.shareholderList.length}}&directory={{data.directoryList.length}}" class="btn btn-info" target="_blank">打印</a>
        <span>状态: </span>
        <span class="tooltip-author" ng-if="data.status != 4" ng-bind="getOrderStatus() + ' | ' + getReviewStatus()" ng-attr-title="{{getTitle(data)}}" style="cursor: default;"></span>
        <span ng-if="data.status == 4" ng-bind="'已完成 | ' + format(data.date_finish, 'YYYY-MM-DD')"></span>
      </div>
    </div>
   <!--  <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">变更信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group" ng-repeat="(key, value) in data.fields" style="color:#00c0ef;">
          <label class="col-sm-2 control-label">{{fields[key]}}</label>
          <div class="col-sm-8">
            <span class="form-span" style="color:#00c0ef; font-weight: bold;" ng-bind="value"></span>
          </div>
        </div>
      </div>
    </div> -->

    <div class="nav-tabs-custom">
      <ul class="nav nav-tabs">
        <li ng-class="{'active': activeTab == 0}" ng-show="!data.logoff"><a data-toggle="tab" ng-click="onTab(0)">基础变更</a></li>
        <li ng-class="{'active': activeTab == 1}" ng-show="!data.logoff"><a data-toggle="tab"  ng-click="onTab(1)">股东变更</a></li>
        <li ng-class="{'active': activeTab == 2}" ng-show="!data.logoff"><a data-toggle="tab" ng-click="onTab(2)">董事变更</a></li>
        <li ng-class="{'active': activeTab == 3}"><a data-toggle="tab" ng-show="data.logoff == 1" ng-click="onTab(3)">注销</a></li>
        <li ng-class="{'active': activeTab == 4}"><a data-toggle="tab" ng-show="data.logoff == 2" ng-click="onTab(4)">转卖</a></li>
      </ul>
      <div class="tab-content">
        <div class="tab-pane" ng-class="{'active': activeTab == 0}">
          <div class="form-group" ng-repeat="(key, value) in data.fields" style="color:#00c0ef;">
            <label class="col-sm-2 control-label">{{fields[key]}}</label>
            <div class="col-sm-8">
              <span class="form-span" style="color:#00c0ef; font-weight: bold;" ng-bind="value"></span>
            </div>
          </div>
          <div ng-if="!data.fields.length" style="padding: 10px;">
            无基础变更数据
          </div>
        </div>
        <div class="tab-pane" ng-class="{'active': activeTab == 1}">
          <table class="table table-hover">
            <tbody>
              <tr>
                <th style="width: 10px">#</th>
                <th>姓名</th>
                <th>性别</th>
                <th>身份证号码</th>
                <th>股份比例(%)</th>
                <th>变更类别</th>
                <th>备注</th>
              </tr>
              <tr ng-repeat="item in data.shareholderList">
                <td ng-bind="($index+1)+'.'"></td>
                <td ng-bind="item.name"></td>
                <td ng-bind="item.gender"></td>
                <td ng-bind="item.cardNo"></td>
                <td ng-bind="item.takes"></td>
                <td ng-bind="getChangeName(item.changed_type)"></td>
                <td ng-bind="item.memo"></td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="tab-pane" ng-class="{'active': activeTab == 2}">
          <table class="table table-hover">
            <tbody>
              <tr>
                <th style="width: 10px">#</th>
                <th>姓名</th>
                <th>性别</th>
                <th>身份证号码</th>
                <th>变更类别</th>
                <th>备注</th>
              </tr>
              <tr ng-repeat="item in data.directoryList">
                <td ng-bind="($index+1)+'.'"></td>
                <td ng-bind="item.name"></td>
                <td ng-bind="item.gender"></td>
                <td ng-bind="item.cardNo"></td>
                <td ng-bind="getChangeName(item.changed_type)"></td>
                <td ng-bind="item.memo"></td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="tab-pane" ng-class="{'active': activeTab == 3}">
          <div class="box-body">
            <div class="form-group">
              <label class="col-sm-3 control-label">档案号</label>
              <div class="col-sm-7">
                <span class="form-span" ng-bind="data.order_code" style="padding-left: 0;"></span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">是否注销</label>
              <div class="col-sm-7">
                <span class="form-span" ng-bind="data.logoff==1 ? '注销' : '否'" style="padding-left: 0;"></span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">备注</label>
              <div class="col-sm-7">
                <textarea style="border: none; background: #fff; padding-left: 0;" class="form-control" disabled rows="3" name="logoff_memo" ng-model="data.logoff_memo" data-rule="length[~100];"></textarea>
              </div>
            </div>
          </div>
        </div>
        <div class="tab-pane" ng-class="{'active': activeTab == 4}">
          <div class="box-body">
            <div class="form-group">
              <label class="col-sm-3 control-label">档案号</label>
              <div class="col-sm-7">
                <span class="form-span" ng-bind="data.order_code" style="padding-left: 0;"></span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">是否转卖</label>
              <div class="col-sm-7">
                <span class="form-span" ng-bind="data.logoff==2 ? '转卖' : '否'" style="padding-left: 0;"></span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">转卖后档案归属地<span class="required">*</span></label>
              <div class="col-sm-7">
                <span class="form-span" ng-bind="data.area_name" style="padding-left: 0;"></span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-3 control-label">备注</label>
              <div class="col-sm-7">
                <textarea style="border: none; background: #fff; padding-left: 0;" class="form-control" disabled rows="3" name="logoff_memo" ng-model="data.logoff_memo" data-rule="length[~100];"></textarea>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">订单信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-2 control-label">档案号</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.order_code"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">客户归属</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.salesman"></span>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">供应商</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.supplier_name"></span>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">变更提成所有人</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.change_owner_name"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">成交日期</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="format(data.date_transaction, 'YYYY-MM-DD')"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">成交金额</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.amount_transaction"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">交易币别</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.currency"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">汇率</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.rate"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">注册进度</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="!!data.progress? (' ' + data.progress) : ' 无进度信息'"></span>
          </div>
        </div>
      </div>
    </div>
    <div class="box box-danger" style="padding-bottom: 30px">
      <div class="box-header with-border">
        <h3 class="box-title">收款记录</h3>
        <div class="box-tools pull-right">
          <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
          </button>
        </div>
      </div>
      <div class="box-body table-responsive no-padding">
        <table class="table table-hover">
          <tbody>
            <tr>
              <th style="width: 10px">#</th>
              <th>付款人</th>
              <th>收款银行</th>
              <th>收款账号</th>
              <th>收款金额</th>
              <th>币别</th>
              <th>汇率</th>
              <th>收款方式</th>
              <th>收款时间</th>
              <th>附件</th>
              <th>备注</th>
              <th class="opt-col">操作</th>
            </tr>
            <tr ng-repeat="item in incomes.items">
              <td ng-bind="($index+1)+'.'"></td>
              <td ng-bind="item.payer"></td>
              <td ng-bind="item.bank"></td>
              <td ng-bind="item.account"></td>
              <td ng-bind="item.amount"></td>
              <td ng-bind="item.currency"></td>
              <td ng-bind="item.rate"></td>
              <td ng-bind="item.pay_way"></td>
              <td ng-bind="format(item.date_pay, 'YYYY-MM-DD')"></td>
              <td>
                <a href="{{item.attachment_url}}" target="_blank" ng-if="item.attachment_url.length">
                  <img ng-src="{{item.attachment_url}}" width="22" height="22">
                </a>
              </td>
              <td ng-bind="item.description"></td>
              <td class="opt-col">
                <a ng-if="data.status == 0" class="fa fa-pencil orange" ui-sref=".income_edit({tid: {{item.id}}})" ui-sref-opts="{location:false}" title="修改"></a>
                <a ng-if="data.status == 0" href="javascript:;" class="fa fa-trash-o red" ng-click="deleteIncome(item)" title="删除"></a>
                <a href="/print.html?m=history_line&id={{item.id}}" target="_blank">打印</a>
              </td>
            </tr>
            <tr>
              <td></td>
              <td class="summary" colspan="2">
                <div>
                  <span>本币: </span>
                  <span class="num">人民币</span>
                </div>
                <div>
                  <span>应收款: </span>
                  <span class="num receivable" ng-bind="incomes.amount"></span>
                </div>
                <div>
                  <span>已收款: </span>
                  <span class="num received" ng-bind="incomes.total"></span>
                </div>
                <div>
                  <span>未收款: </span>
                  <span class="num balance" ng-bind="incomes.balance"></span>
                </div>
              </td>
              <td class="summary" colspan="2">
              </td>
              <td class="summary" colspan="7">
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="box-footer clearfix">
        <button type="button" class="btn btn-info" ui-sref=".income_add({source_name: 'history', customer_id: data.customer_id})" ui-sref-opts="{location:false}">新增</button>
        <button type="button" class="btn btn-info" ng-click="printReceipt('new')">新增收据</button>
        <button type="button" class="btn btn-info" ng-click="printReceipt('print')">打印收据</button>
      </div>
    </div>
  </form>
</section>
<div ui-view="modal"></div>
<div ui-view="progress"></div>
<div ui-view="print"></div>
